<template>
    <div>
  <van-nav-bar
      title="搜索结果"
      left-text="返回"
      left-arrow
      @click-left="$router.go(-1)"
      :item="data"
    />
      <div class="kapian" v-if="data">
   <div class="内容" v-for="s in data.result" :key="s.lid">
      <div class="ka">
        <div>
          <img :src="`http://localhost:3000/${s.laptop_pic1}`" alt="">
        </div>
        <div>
          <div>{{s.title}}</div>
          <div class="wen">
            <div>
              <h4>￥:{{s.price}}</h4>
              <p>销量:{{s.spec}}</p>
            </div>
            <div class="tubiao" @click="Goxq(s.lid)">
              <van-icon name="cart" color="red" size="35px"/>
            </div>
          </div>
        </div>      
      </div>
   </div>
  </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                data: null,
                s:this.$store.state.sousuo
              
            }
        },

        mounted(){

   this.axios.post('http://localhost:3000/sousuo',`dd=${this.s}` ).then(res=>{
        if(res.data.code!==200){
        this.$toast({
  message: '相关信息未找到',
  icon: 'warning-o'
})
    }
    console.log(res.data)
    this.data=res.data

   })

        },
        methods:{

           Goxq(lid){
               this.$router.push({
          path:'/porduct',
          query:{
            id:lid
          }
        })
           }
        }
        
    }
</script>

<style lang="scss" scoped>

</style>

<style scoped src='../assets/css/kapian.css'></style>